﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;

namespace Baocao
{
	public partial class Print : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			if (Session["Report"] != null)
			{
				ReportToolbar1.ReportViewer = ReportViewer1;
				ReportViewer1.Report = (DevExpress.XtraReports.UI.XtraReport)Session["Report"];
			}
		}

		protected void ReportViewer1_CacheReportDocument(object sender, DevExpress.XtraReports.Web.CacheReportDocumentEventArgs e)
		{
			e.Key = Guid.NewGuid().ToString();
			Page.Session[e.Key] = e.SaveDocumentToMemoryStream();
		}

		protected void ReportViewer1_RestoreReportDocumentFromCache(object sender, DevExpress.XtraReports.Web.RestoreReportDocumentFromCacheEventArgs e)
		{
			Stream stream = Page.Session[e.Key] as Stream;
			if (stream != null)
				e.RestoreDocumentFromStream(stream);
		}

		protected void ReportViewer1_Unload(object sender, EventArgs e)
		{
			ReportViewer1.Report = null;
		}
	}
}
